package com.poizon.infrastructure.idem.core.annoations.config;

import com.poizon.infrastructure.idem.core.annoations.aop.AntiSubmitAspect;
import com.poizon.infrastructure.idem.core.annoations.aop.IdempotentAspect;
import com.poizon.infrastructure.idem.core.util.IIdemUtil;
import com.poizon.infrastructure.idem.core.util.IRepeatedSubmitUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;

/**
 * 注解/bean注入
 */
@Slf4j
public class AopConfig {
    @Bean
    public IdempotentAspect initIdempotentAspect(IIdemUtil idemUtil) {
        log.info("[通用幂等框架] 成功初始化幂等注解切面");
        return new IdempotentAspect(idemUtil);
    }
    @Bean
    public AntiSubmitAspect initAntiSubmitAspect(IRepeatedSubmitUtil repeatedSubmitUtil) {
        log.info("[通用幂等框架]  成功初始化防重复提交注解切面");
        return new AntiSubmitAspect(repeatedSubmitUtil);
    }
}
